import { Column, Entity, Index, PrimaryGeneratedColumn } from "typeorm";

@Index("device_id", ["deviceId"], {})
@Entity("water_bills", { schema: "bacsense_water" })
export class WaterBills {
  @PrimaryGeneratedColumn({ type: "int", name: "id", unsigned: true })
  id: number;

  @Column("int", { name: "user_id", unsigned: true, default: () => "'0'" })
  userId: number;

  @Column("int", { name: "device_id", unsigned: true, default: () => "'0'" })
  deviceId: number;

  @Column("decimal", {
    name: "amount",
    precision: 6,
    scale: 2,
    default: () => "'0.00'",
  })
  amount: string;

  @Column("int", { name: "water_usage", unsigned: true, default: () => "'0'" })
  waterUsage: number;

  @Column("int", { name: "tds_raw", unsigned: true, default: () => "'0'" })
  tdsRaw: number;

  @Column("int", { name: "tds_clean", unsigned: true, default: () => "'0'" })
  tdsClean: number;

  @Column("int", {
    name: "report_time",
    comment: "上报时间",
    unsigned: true,
    default: () => "'0'",
  })
  reportTime: number;

  @Column("int", {
    name: "create_time",
    comment: "创建时间",
    unsigned: true,
    default: () => "'0'",
  })
  createTime: number;
}
